$(function () {
    let url = {
        af: 'front/queryAnFangZiZhi',
        xy: 'front/queryXinYongDengJi',
        ry: 'front/queryRenYuan'
    }
    $('#searchPage').on('click', '.searchbar a', function (e) {
        let partId = $(this).attr('goto')
        let inputVal = $.trim($(this).parent().find('input').val())
        if (inputVal === '') {
            $.alert('请输入查询内容！')
            return
        }
        let cururl = ''
        if (partId === 'msearch_1') {
            cururl = url.af
        } else if (partId === 'msearch_2') {
            cururl = url.ry
        } else if (partId === 'msearch_3') {
            cururl = url.xy
        }
        let param = {
            nameOrNum: inputVal
        }
        console.log(cururl)
        $.post(cururl, param, (data) => {
            if (data.success) {
                $.router.load("#" + partId)
                $("#" + partId).find('.item-text').each(function() {
                    console.log($(this).attr('name'))
                    $(this).html(data[$(this).attr('name')] || '')
                })
            } else {
                $.alert(data.msg)
            }
        })
    })
})